<template>
    <div>
      <h1>登录</h1>
      <LoginForm @submit="handleLogin" />
    </div>
  </template>
  
  <script setup lang="ts">
  import { useRouter } from 'vue-router'
  import { useAuthStore } from '../stores/auth'
  import LoginForm from '../components/LoginForm.vue'
  
  const authStore = useAuthStore()
  const router = useRouter()
  
  const handleLogin = async (username: string, password: string) => {
    await authStore.login(username, password)
    router.push('/chats')
  }
  </script>

<style scoped>
@import '../styles/login.css';
</style>